Unify GSC analytics response contract and status-driven consumers#429
Closed
Unify GSC analytics response contract and status-driven consumers#429
Conversation
AJaySi
added a commit
that referenced
this pull request
Mar 22, 2026
huggingface_provider.py: - Add retry logic with _should_retry_hf_error and _is_non_retryable_hf_error - Update default models from :groq to :cerebras (HF_FALLBACK_MODELS) - Add fallback_models parameter to huggingface_text_response - Add get_available_models with updated model list main_text_generation.py: - Add GPT_PROVIDER and TEXTGEN_AI_MODELS env var support - Add preferred_provider and flow_type parameters to llm_text_gen - Add HF_MODEL_MAPPING for short model name resolution - Add flow_type logging tag for better observability sif_agents.py: - Add LOW_COST_SHARED_REMOTE_MODELS for SIF agents - Update SharedLLMWrapper to use preferred_hf_models and flow_type These changes preserve the modular textgen_utils structure while incorporating the useful routing and retry logic improvements from the pending PRs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
get_search_analyticsalways returns a single, predictable shape so downstream code can rely on keys rather than presence checks.statusmarker and empty collections.status+ guaranteed keys instead of brittle key-existence logic.Description
GSCService.get_search_analytics:_base_payload(status, error)and_normalize_payload(payload)that guarantee the unified contract with keys:overall_metrics.rows,query_data.rows,page_data.rows,query_page_data.rows,verification_data.rows,date_range(start/end),site_url,startDate/endDate/siteUrlaliases,status, and optionalerror/warning.get_search_analyticsto return the canonical payload with appropriatestatusvalues (examples:not_connected,auth_failed,no_data,verification_failed,api_error,partial_success,success,error) and empty arrays instead of ad-hoc dict shapes.date_range,site_url, andstatusand ensure cached responses are converted via_normalize_payloadbefore being returned.statusand guaranteed keys:backend/services/analytics/handlers/gsc_handler.pynow derives metrics fromoverall_metrics/query_dataand computes connection status fromstatus;backend/services/scheduler/executors/gsc_insights_executor.pychecksstatusrather than presence of'error'; onboarding normalizernormalize_gsc_analyticsgates processing based onstatus.Testing
python -m compileall backend/services/gsc_service.py backend/services/analytics/handlers/gsc_handler.py backend/services/scheduler/executors/gsc_insights_executor.py backend/api/content_planning/services/content_strategy/autofill/normalizers/analytics_normalizer.pyand all modified modules compiled without syntax errors.Codex Task